package com.uplift.mobile.info.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.github.pagehelper.PageHelper;
import com.uplift.mobile.info.dao.IInfoMapper;
import com.uplift.mobile.info.model.Info;
import com.uplift.mobile.info.service.IInfoService;

@Service
@Transactional
public class InfoServiceImpl implements IInfoService {

	@Autowired
	private IInfoMapper infoMapper;

	@Override
	public List<Map<String, Object>> queryInfo(Info info) {
		PageHelper.startPage(info.getPage(), info.getPageSize());
		return this.infoMapper.selectInfo(info);
	}

	@Override
	public Map<String, Object> queryInfoDetail(Info info) {
		List<Map<String, Object>> list = this.queryInfo(info);
		if (list != null && list.size() > 0) {
			return list.get(0);
		} else {
			return null;
		}
	}

}
